<template>
  <div class="about">
    <h1>This is第二个工程的 an about page</h1>
    <div>获取到的token{{token}}</div>
 
  </div>
</template>
<script>
// @ is an alias to /src
// micro-app-vue/src/pages/communication/index.vue// 引入 actions 实例
import actions from "../action";
export default {
  name: "About",
  data() {
    return {
      token:''
       };
  },
  components: {},
  mounted() {
    const _this = this

    actions.onGlobalStateChange(state => {
      console.log('监听到改变',state)
      const { token } = state; // 未登录 - 返回主页
      if (!token) {
        this.$message.error("未检测到登录信息！");
        return this.$router.push("/");
      } // 获取用户信息
      _this.token = token
      // this.getUserInfo(token);
    }, true);
  },
  methods: {
    changeToken(){
      actions.setGlobalState({
        token:'第DOME子工程'
      })
    }
  }
};
</script>
